GBML manual / Camera

camera_set

Stops following (if it was) and immediately places the camera so that its view begins at (x, y) - the top-left corner of what the screen shows, counted from the room’s top-left corner - still clamped to camera_bounds if any are set - an exact, unshimmering jump, not a multi-frame ease.

Syntax

camera_set(x, y)

Arguments

NameType
xreal
yreal

Returns

Nothing.

Description

Stops following (if it was) and immediately places the camera so that its view begins at (x, y), still clamped to camera_bounds if any are set - an exact, unshimmering jump, never a multi-frame ease. The usual tool for a fixed scripted shot: pointing the camera at a specific spot in the room that has nothing to do with any instance's own position.

(x, y) is where the camera's view begins - the top-left corner of what the screen shows - as a place in the room, counted from the room's top-left corner. So camera_set(0, 0) shows the room from its own top-left corner, and on the GBA (240 by 160) the view then covers x from 0 to 240 and y from 0 to 160. To put the camera's middle on a spot, subtract half the screen.

Example

camera_set(room_width() / 2 - screen_width() / 2, room_height() / 2 - screen_height() / 2);

Centers the camera on the room's own middle - a plain establishing shot, independent of where any instance happens to be. room_width() / 2 is the room's middle, and taking away screen_width() / 2 moves the top-left corner of the view back so the middle of the screen lands there. (camera_set(0, 0), by contrast, puts the view's top-left corner on the room's top-left corner.)